/-app
/-app/appRoot
/-app/appRoot/importExport
exportAllHTML.ts
exportAllZIP.ts
exportBlob.ts
loadFile.ts
saveFileName.ts
PageModel.ts
dragScroll.ts
/-app/koBindingHandlers
load.ts
loadRaw.ts
register.ts
/-app/moreDialog
Model.ts
layout.html
style.css
body.css
flyout-branding.css
flyout.css
start.ts
status.css
tree-and-bar.css
tree-details.css
/-docs
/-docs/types
/-docs/types/text
/-docs/types/text/js
JavaScriptDocHandler.ts
/-docs/types/text/scrollerView
ScrollerModel.ts
ScrollerView.html
style.css
CodeMirror-ext.css
CodeMirrorDocHandler.ts
api.ts
load.ts
api.ts
listSubmodules.ts
load.ts
DocHost.ts
/-files
FileTree.css
FileTree.ts
/-imports
/-persistence
Drive.ts
indexedDB.ts
mountDrive.ts
/-typings
errors.js
functions.ts
index.html
try.js
x
    var blob: Blob = new (<any>Blob)(['<!doctype html>\n', document.documentElement.outerHTML], { type: 'application/octet-stream' });
130
    var passableOnly = true;
131
​
132
    for (var i = 0; i < value.length; i++) {
133
      var c = value.charAt(i);
134
      var cc = value.charCodeAt(i);
135
      codes.push(cc);
136
      if (passableOnly)
137
        passableOnly = (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z' || c === '_' || c === '-');
138
    }
139
​
140
    if (passableOnly)
141
      return 's-' + value;
142
    else
143
      return 'n-' + codes.join('-');
144
  }
145
​
146
  export function decodeFromAttributeName(attributeNamePart: string): string {
147
    if (attributeNamePart.slice(0, 2) === 's-')
148
      return attributeNamePart.slice(2);
149
​
150
    var codes = attributeNamePart.slice(2).split('-');
151
    var result: string[] = [];
152
    for (var i = 0; i < codes.length; i++) {
153
      try {
154
        result[i] = String.fromCharCode(parseInt(codes[i]));
155
      }
156
      catch (error) {
157
        console.log('Parsing attribute name error: ' + attributeNamePart + ' has non-numeric chunk ' + i + ' (' + codes[i] + ').');
158
        return null;
159
      }
160
    }
161
    return result.join('');
162
  }
163
​
164
  export function startsWith(str: string, prefix: string) {
165
    if (!str) return !prefix;
166
    if (!prefix) return false;
167
    if (str.length < prefix.length) return false;
168
    if (str.charCodeAt(0) !== prefix.charCodeAt(0)) return false;
169
    if (str.slice(0, prefix.length) !== prefix) return false;
170
    else return true;
171
  }
172
​
173
  export function dateNow(): number {
174
    if (Date.now)
175
      return Date.now();
176
    else
177
      return new Date().valueOf();
178
  }
179
​
180
  export var objectKeys = (obj: any): string[] => {
181
    if (typeof Object.keys === 'function')
182
      objectKeys = Object.keys;
183
    else
184
      objectKeys = (obj: any): string[] => {
185
        var result: string[] = [];
186
        for (var k in obj) if (obj.hasOwnProperty(k)) {
187
          result.push(k);
188
        }
153:18